import java.util.ArrayList;
import java.util.List;

/**
 * Created by Shaobing on 24/05/2014.
 */
public class PrimeFactors {
    public static List<Integer> generate(int input) {
        List<Integer> factors = new ArrayList();
        input = Math.abs(input);

        if(input == 0 || input == 1)
            return factors;

        while(input % 2 == 0){
            factors.add(2);
            input = input / 2;
        }

        for(int i = 3; i < input; i += 2){
            while(input % i == 0){
                factors.add(i);
                input /= i;
            }
        }

        if(input > 2)
            factors.add(input);

        return factors;
    }
}
